package com.ry.provide.controller;

import com.ry.provide.config.ServerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 请求测试类
 */
@RestController
@RequestMapping(value = "/test")
public class TestApi {
    @Autowired
    private ServerConfig serverConfig;

    @GetMapping("/testHello")
    public String hello() throws UnknownHostException {
        InetAddress address = InetAddress.getLocalHost();
        return "helloWorld:" + address.getHostAddress() + ":" + ServerConfig.getPort();
    }
}
